package com.baosight.sczx.common.zm.cInterface.cl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;

public class SecurityItems{
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 查询所有安全检查项目
	 * <p>Function: queryItem</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-29下午12:40:44 高强
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static EiInfo queryItem(EiInfo info)
	{	
		List<Map>  _list = new ArrayList();
		try{
			Map<String, String> para = new HashMap<String, String>();
			para.put("fdItemInfo", info.getString("fdItemInfo").toString());
			_list = dao.query("ZMCLSecurityItems.querySecurityItems", para);
			info.getBlock(EiConstant.resultBlock).addBlockMeta(initMetaData());
			info.getBlock(EiConstant.resultBlock).setRows(_list);
		}catch(Exception e){
			return info;
		}
		return info;
	}
	
	/**
	 * 构造列
	 * <p>Function: initMetaData</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-29下午12:40:44 高强
	 * </p>
	 *
	 */
	public static EiBlockMeta initMetaData() {
		EiBlockMeta eiMetadata = new EiBlockMeta();
		EiColumn eiColumn;
		eiColumn = new EiColumn("fdKeyId");
		eiColumn.setPrimaryKey(true);
		eiColumn.setFieldLength(32);	
		eiColumn.setDescName("主键");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdItemCode");
		eiColumn.setFieldLength(20);	
		eiColumn.setDescName("检查项目编号");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdItemContent");
		eiColumn.setFieldLength(200);	
		eiColumn.setDescName("检查项目内容");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdFrequency");
		eiColumn.setType("N");
		eiColumn.setScaleLength(0);
		eiColumn.setFieldLength(38);
		eiColumn.setDescName("检查频率");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdFrequencyUnits");
		eiColumn.setFieldLength(5);	
		eiColumn.setDescName("检查频率单位");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdStandard");
		eiColumn.setFieldLength(500);	
		eiColumn.setDescName("检查标准");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdStep");
		eiColumn.setFieldLength(500);	
		eiColumn.setDescName("检查步骤");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdItemType");
		eiColumn.setFieldLength(32);	
		eiColumn.setDescName("检查项目类型");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdStatus");
		eiColumn.setFieldLength(10);	
		eiColumn.setDescName("状态");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdRemark");
		eiColumn.setFieldLength(200);	
		eiColumn.setDescName("备注");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdSurveypointName");
		eiColumn.setFieldLength(30);	
		eiColumn.setDescName("巡检点名称");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdItemInfo");
		eiColumn.setFieldLength(220);	
		eiColumn.setDescName("检查项目信息");
		eiMetadata.addMeta(eiColumn);
		return eiMetadata;
	}
}
